import numpy as np


def _get_kernel(mapping):
    # the more mapping values close to int, the kernel edge close to smooth
    kernel = np.ones([int(mapping)*2-1,int(mapping)*2-1])
    edge_coef = mapping-int(mapping)
    kernel[0,1:-1] = kernel[-1,1:-1] = kernel[1:-1,0] = kernel[1:-1,-1] = edge_coef
    kernel[0,0] = kernel[-1,0] = kernel[0,-1] = kernel[-1,-1] = 0
    nor_coef = np.sum(kernel)
    kernel = kernel/np.sum(kernel)
    return kernel